#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableSceneBotMonsterDao:DaoBase<TableSceneBotMonster>
    {
        public override string GetFileName()
        {
            return "TableSceneBotMonster.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableSceneBotMonster>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableSceneBotMonster model)
        {
            if (!cacheOneIndex.ContainsKey(model.SceneId.ToString()))
            {
                cacheOneIndex[model.SceneId.ToString()] = new List<TableSceneBotMonster>();
            }
            cacheOneIndex[model.SceneId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableSceneBotMonster model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.MonstersId)) UnityEngine.Debug.LogError("数据表id重复:TableSceneBotMonster->id: " + model.MonstersId);
            #endif
            cachePrimaryInt[model.MonstersId] = model;
        }
        protected override TableSceneBotMonster ParseRowData(string[] rowData)
        {
            TableSceneBotMonster data = new TableSceneBotMonster();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.MonstersId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.SceneId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.Level = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.Name = rowData[3];
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.Position = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.IsTaskMonster = int.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.MaxDistance = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.monsterIcon = rowData[7];
            }
            return data;
        }
    }
}
